package com.wuliu.business.spot;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.wuliu.model.spot.Spot;
import com.wuliu.model.sys.Menu;
import com.wuliu.model.sys.User;
import com.wuliu.util.DbPool;
import com.wuliu.util.DbUtil;

public class SpotObj {
	public static Spot getSpotById(String id){
		Connection conn = null;
		PreparedStatement pstmt = null;
		ResultSet rs = null;
		Spot spot = new Spot();
		if(id==null || id.equals(""))
			return spot;
		String strsql = "SELECT * FROM WL_SPOT WHERE SPOT_ID=?";
		try{
			conn = DbPool.getConnection();
			pstmt = conn.prepareStatement(strsql);
			pstmt.setString(1,id);
			rs = pstmt.executeQuery();
			if(rs.next()){
				spot.setSpotId(rs.getString("SPOT_ID"));
				spot.setSpotName(rs.getString("SPOT_NAME"));
				spot.setSpotCode(rs.getString("SPOT_CODE"));
				spot.setProvince(rs.getString("PROVINCE"));
				spot.setCity(rs.getString("CITY"));
				spot.setTown(rs.getString("TOWN"));
				spot.setSpotAddr(rs.getString("SPOT_ADDR"));
				spot.setAddBy(rs.getString("ADD_BY"));
				spot.setAddDate(rs.getString("ADD_DATE"));
				spot.setAddTime(rs.getString("ADD_TIME"));
				spot.setUpdBy(rs.getString("UPD_BY"));
				spot.setUpdDate(rs.getString("UPD_DATE"));
				spot.setUpdTime(rs.getString("UPD_TIME"));
				spot.setActiveFlag(rs.getString("ACTIVE_FLAG"));
			}
		}catch(SQLException sqlE){
			sqlE.printStackTrace();
		}finally{
			DbPool.close(conn, pstmt, rs);
		}
		return spot;
	}
}
